package com.bauer.base.algorithm.dynamicprogramming;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

/**
 * @Author ：rui.wei
 * @Date ：Created in 11:21 2019/8/2
 * @Description：
 */
public class FibonacciDemo {


    public int fb(int i, int j) {
        int sum = i + j;

        return 0;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String number = scanner.nextLine();
        toYuan(number);

    }

    public static void toYuan(String numberStr) {
        char[] unit = new char[]{'分', '角', '元', '拾', '佰', '仟', '万', '亿'};
        char[] number = new char[]{'零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'};
        char[] stack = new char[100];
        int start = 0;
        int unitIndex = 0;
        int total = -3;
        char[] value = new String(numberStr).toCharArray();
        for (int i = value.length - 1; i >= 0; i--) {
            total++;
            if (value[i] == '.') {
                if (start == 0) {
                    stack[start] = '整';
                    ++start;
                }
                continue;
            }

            if (total == 9) {
                stack[start] = unit[7];
            } else {
                stack[start] = unit[unitIndex];
            }

            start++;
            if (value.length - i > 4 && unit[unitIndex] == unit[2]) {
                start--;
            }
            if (value[i] != '0') {
                stack[start] = number[Integer.parseInt(value[i] + "")];
                start++;
            } else {
                if (stack[start - 1] != '元' && stack[start - 1] != '万' && stack[start - 1] != '亿') {
                    start--;
                }
                if (start > 0 && stack[start - 1] != number[0] && (stack[start - 1] != '元' && stack[start - 1] != '万'
                    && stack[start - 1] != '亿' && total != -1)) {
                    stack[start] = number[0];
                    start++;
                }
            }
            unitIndex++;

            if (unitIndex > 6 && total != 8) {
                unitIndex = 3;
            }

        }
        System.out.print("人民币");
        if (stack[start - 1] == '元') {
            start--;
        }
        for (int j = start - 1; j >= 0; j--) {
            if (j > 0 && stack[j] == '壹' && stack[j - 1] == '拾') {

            } else {
                System.out.print(stack[j]);
            }

        }
    }
}
